<template>
    <div>
        <van-nav-bar title="首页" left-text="返回" left-arrow @click-left="onClickLeft" />
        <van-search v-model="value" show-action label="地址" placeholder="请输入搜索关键词" @search="onSearch" @click="ss">
            <template #action>
                <div @click="onClickButton">搜索</div>
            </template>
        </van-search>
        <van-tabs v-model:active="active" animated>
            <van-tab title="首页">
                <van-swipe :autoplay="3000" lazy-render>
            <van-swipe-item v-for="image in images" :key="image">
                <img style="width: 100%;height: 200px;" :src="image" />
            </van-swipe-item>
        </van-swipe>

        <van-grid :column-num="4">
            <van-grid-item v-for="value in catitemsdata" :key="value" :icon="value.image_src" :text="value.name" />
        </van-grid>

        <div v-for="key in floordatadata" :key="key">
            <img style="width: 100%;" :src="key.floor_title.image_src" alt="">
            <div v-for="key in key.product_list" :key="key">
                <img style="width: 120px;height: 120px;float: left;" :src="key.image_src" alt="">
            </div>
        </div>
        </van-tab>
        </van-tabs>
        </div>
</template>

<script setup>
const images = [
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-1.jpeg',
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-2.jpeg',
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-3.jpeg',
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-4.jpeg',
];
import { catitemsApi } from '@/api/api'
import {floordataApi} from '@/api/api'
import {ref} from 'vue'
const catitemsdata=ref([])
const floordatadata=ref([])
catitemsApi().then(res=>{
    catitemsdata.value=res.data.message
    console.log('导航',res);
    
})
floordataApi().then(res=>{
    floordatadata.value=res.data.message
    console.log('楼层',res);
    
})
</script>

<style lang="scss" scoped></style>